home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4171 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  43 lines

  1. Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
  2. From: Dan Pop <danpop@mail.cern.ch>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: void main() and other atrocities!
  5. Date: Fri, 2 Feb 1996 14:00:22 +0100
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <9602021300.AA04359@dxmint.cern.ch>
  8. References: <4eduaj$1aq@grouper.Exis.Net> <4em17r$shq@jaxnet.jaxnet.com> <4emub9$1mo@fountain.mindlink.net> <4epplj$egf@host-3.cyberhighway.net> <4erjn2INN38b@keats.ugrad.cs.ubc.ca>
  9. X-NNTP-Posting-Host: hpl3sn03.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11. X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
  12.  
  13. c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  14.  
  15. >There is nothing with 'void main()'. It's not giverned by the ANSI standard,
  16. >first of all, because that is not an ANSI definition. An ANSI definiton would
  17. >be more like 'void main(void)'.
  18.  
  19. 'void foo()' and 'void foo(void)' are 100% equivalent as function
  20. _definitions_ in ANSI C.  They're different only when used as function
  21. _declarations_ (one is a prototype, the other isn't). 
  22.  
  23. >You don't need main() to be defined has having any sort of return value unless
  24. >you plan to "return" out of it. If you use exit(0) like me, declaring the
  25. >function void is ok, since your function never returns.
  26.  
  27. BULLSHIT.  Please read the FAQ before posting such nonsense.
  28.  
  29.     AxCrnA$ cc test.c
  30.  
  31.     void main() {exit(0);}
  32.     .....^
  33.     %CC-E-NEEDNONVOID, In this statement, "main(...)" has void type, but occurs
  34.     in a context that requires a non-void result.
  35.     at line number 2 in file DISK$L32:[DANPOP]TEST.C;3
  36.  
  37. Dan
  38. -- 
  39. Dan Pop
  40. CERN, CN Division
  41. Email: danpop@mail.cern.ch 
  42. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  43.